local skill = fk.CreateSkill {
  name = "klee_seal_active_skill&",
}

Fk:loadTranslationTable{
  ["klee_seal_active_skill&"] = "玉玺",
  [":klee_seal_active_skill&"] = "你可以交给【玉玺】拥有者一张手牌，将势力变更至与其相同",
  ["#klee_seal_use"] = "玉玺：你可以交给【玉玺】拥有者一张手牌，将势力变更至与其相同",
}

skill:addEffect("active", {
  prompt = "#klee_seal_use",
  mute = true,
  card_num = 1,--一张牌
  target_num = 1,--一个人
  can_use = function(self, player)--有人装备区玉玺时
    if player:usedSkillTimes(skill.name, Player.HistoryPhase) < 1 then
      for _,p in ipairs(Fk:currentRoom().alive_players)do
        for _,cid in ipairs(p:getEquipments(Card.SubtypeTreasure))do
          if Fk:getCardById(cid).name == "klee_seal" then
            return true
          end
        end
      end
    end
  end,
  card_filter = function(self, player, to_select, selected)--选一张手牌
    return #selected < 1 and table.contains(player:getCardIds("h"), to_select)
  end,
  target_filter = function(self, player, to_select, selected)--选一个有玉玺的其他人
    for _,cid in ipairs(to_select:getEquipments(Card.SubtypeTreasure))do
      if Fk:getCardById(cid).name == "klee_seal" then
        return to_select ~= player and #selected == 0
      end
    end
  end,
  on_use = function(self, room, effect)
    local player = effect.from
    local target = effect.tos[1]
    if not target then return end
    room:doIndicate(player.id, { target.id })--动画
    room:broadcastPlaySound("./packages/klee_xy_I/audio/card/klee_seal_active_skill")
    room:moveCardTo(effect.cards, Player.Hand, target, fk.ReasonGive, skill.name, nil, true, player)--给牌
    if player.kingdom ~= target.kingdom then
      room:changeKingdom(player, target.kingdom, true)--变更势力
    end
  end,
})

return skill